#ifndef _SCENESTATE_H
#define _SCENESTATE_H

#pragma once
#include "Observable.h"
#include "SceneObjectState.h"
#include "persistence\SceneStateRepository.h"
#include "concurrent\CriticalSection.h"
#include "ui\Scene.h"
#include "ui\SceneObject.h"
#include "Tokenizer.h"
#include "ByteBuffer.h"
#include <string>
#include <map>
#include <list>
#include <iostream>

using namespace std;
using namespace ui;
using namespace concurrent;
typedef std::list<SceneObjectState*> LISTOBJSTA;

class SceneState : public Observable
{
public:
	SceneState(string);
	virtual ~SceneState(void);
	//bool ocurredInside(int posX, int posY);
	void loadSceneBox();
	void setX(int);
	int getX(void);
	string getSceneName();
	list<SceneObjectState*>* getObjectsState();
	int getWidth();
	int getHeight();
	void setY(int);
	int getY(void);
	virtual ByteBuffer* marshal(void);
	virtual void unmarshal(ByteBuffer*);
	string getBackgroundPath();
	void updateState(SceneObjectState*);
	void updateNewBullet(SceneObjectState*);
	void updateBulletDeath(SceneObjectState*);
	void updateTankOff(SceneObjectState*);
	void updateNewTank(SceneObjectState*);
private:
	CriticalSection* lock;
	string name;
	list<SceneObjectState*> objectsState;
	//map<string, SceneObjectState*> objectsState;
	int x_coordinate;
	int y_coordinate;
	int width;
	int height;
	string backgroundPath;
};

#endif
